unit USalvarXML;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UFomCadastro, DBCtrls, StdCtrls, Buttons, ExtCtrls, DB, DBTables,
  Mask, ToolEdit, RXDBCtrl, Grids, DBGrids, ComCtrls, DBClient, CurrEdit,
  QuickRpt, Provider, Menus, RxDBComb, Math, ActnList,shellapi,IdGlobal,dateutils;

type
  TFSalvarXML = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    edCaminhoNome: TComboEdit;
    SaveDialog1: TSaveDialog;
    Button1: TButton;
    FilenameEdit1: TFilenameEdit;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Button1Click(Sender: TObject);
    procedure edCaminhoNomeButtonClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FSalvarXML: TFSalvarXML;

implementation

{$R *.dfm}
uses UDmGestao, UGeral,  UCobranca,
  VendaCancelaNotaFiscal, UEmissaoNotaFiscal,
  UPesquisaItemNotaFiscal, UGestao, UPesquisaRapida, UEmissaoCobrancaVendas,
  PedidoVenda_NOVO, UValoresEstoqueProduto, UPesquisaNovaNFVenda,
  UConsultaNFNaoEmitida, UPesquisaPedidoNotaFiscal, UConsultaItensNfMae;


procedure TFSalvarXML.FormClose(Sender: TObject; var Action: TCloseAction);
begin

 FSalvarXML.Release;
 FSalvarXML := nil;

 gravaIni('SALVAR_XML','Caminho_Destino',edCaminhoNome.Text);

end;

procedure TFSalvarXML.Button1Click(Sender: TObject);
begin
    if CopyFile(Pchar(Edit1.Text),Pchar(edCaminhoNome.Text),false) then
//    if CopyFileTo(Edit1.Text,edCaminhoNome.Text) then
    begin
      ShowMessage('Arquivo Copiado com Sucesso!');
      close;
    end else begin
      ShowMessage('Falha na copia do arquivo.');
    end;

end;

procedure TFSalvarXML.edCaminhoNomeButtonClick(Sender: TObject);
begin
{   SaveDialog1.Execute;

   if SaveDialog1.FileName <> '' then
     edCaminhoNome.Text:= SaveDialog1.FileName;}
end;

end.
